package chen.web;

public class BusinessException extends RuntimeException {

	private static final long serialVersionUID = 4693939972758458970L;
	
	public static final int Undefined = 0;
	
	/**
	 * 帐号被冻结，不能登录
	 */
	public static final int Account_Cannot_Login = 103;
	/**
	 * 邮箱地址已经被注册
	 */
	public static final int Email_Adress_Has_Already_Been_Registered = 104;
	/**
	 * 昵称已经被注册
	 */
	public static final int Nickname_Has_Already_Been_Registered = 105;
	
	/**
	 * 邮件发送失败
	 */
	public static final int Email_Sending_Failed = 201;
	
	/**
	 * 主题禁止回复
	 */
	public static final int Forum_Forbid_Reply = 301;
	
	/**
	 * 发表回复或主题太快
	 */
	public static final int Forum_Operation_Frequency_Limit = 302;
	
	/**
	 * 不能删除含有子栏目的栏目
	 */
	public static final int Forum_Can_Not_Delete_Category_Has_Child = 303;
	
	/**
	 * 不能删除含有主题的栏目
	 */
	public static final int Forum_Can_Not_Delete_Category_Has_Subject = 304;
	
	/**
	 * 已经投过票了,不能再投
	 */
	public static final int Vote_Has_Voted = 401;
	/**
	 * 用户选的选项数量超过了可选数量
	 */
	public static final int Vote_Outnumber_Optional_Quantity  = 402;
	/**
	 * 不能公开投票者信息
	 */
	public static final int Vote_Can_Not_Public_Voters = 403;
	/**
	 * 至少要有两项投票选项
	 */
	public static final int Vote_At_Least_Two_Option = 404;
	
	/**
	 * 重复收藏
	 */
	public static final int Favorite_Duplicate = 501;
	
	/**
	 * 博客栏目数量超出限制
	 */
	public static final int Category_Count_Limit = 601;
	
	public BusinessException(){
		super();
		this.exceptionCode = Undefined;
	}
	
	private int exceptionCode;
	public BusinessException(int code){
		super();
		this.exceptionCode = code;
	}
	
	public BusinessException(int code, Throwable t){
		super(t);
		this.exceptionCode = code;
	}
	
	public int getExceptionCode(){
		return exceptionCode;
	}
}
